import 'package:flutter/material.dart';
import 'package:qqmusic/page/detail_page/squaredetail.dart';

class square extends StatefulWidget {
  square({Key key}) : super(key: key);

  @override
  State<square> createState() => _squareState();
}

class _squareState extends State<square> with TickerProviderStateMixin {
  TabController controller;
  List<Widget> tabs = [Text('广场'), Text('关注')];
  @override
  void initState() {
    super.initState();
    controller =
        TabController(length: tabs.length, vsync: this, initialIndex: 0);
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          SafeArea(
              child: Container(
            // alignment: Alignment.topLeft,
            width: MediaQuery.of(context).size.width * .4,
            padding: EdgeInsets.only(left: 15),
            child: Theme(
              data: ThemeData(
                  highlightColor: Colors.transparent,
                  splashColor: Colors.transparent),
              child: TabBar(
                labelColor: Colors.black,
                labelStyle:
                    TextStyle(fontSize: 18, fontWeight: FontWeight.w700),
                indicatorSize: TabBarIndicatorSize.label,
                indicatorColor: Color(0xff3be68e),
                indicatorWeight: 3,
                controller: controller,
                tabs: this.tabs,
                unselectedLabelStyle:
                    TextStyle(fontWeight: FontWeight.w600, fontSize: 17),
              ),
            ),
          )),
          Expanded(
              child: TabBarView(
            children: [
              squareItem(
                name: 'g',
              ),
              squareItem(
                name: 's',
              )
            ],
            controller: controller,
          ))
        ],
      ),
    );
  }
}
